package com.ddy.controller;

import com.ddy.common.R;
import com.ddy.entity.Movie;
import com.ddy.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class ApiTest {
    @Autowired
    CacheManager cacheManager;
    @Autowired
    MovieService movieService;
    @RequestMapping("/hello")
    public R hello(){
        return R.success("hello");
    }

    @GetMapping("/movies")
    public R getMovies(Movie movie){
        List<Movie> moviesByAuth = movieService.getMoviesByAuth(movie);
        return R.success(moviesByAuth);
    }
}
